<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>空间分析服务-叠加分析</title>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? document.location.protocol + "//" + document.location.host : "http://support.supermap.com.cn:8090";
    var map, overlayAnalystService, datasetOverlayAnalystParameters, resultLayer,
        baseUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图",
        serviceUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
    map = L.map('map', {
        crs: L.CRS.EPSG4326,
        center: [40.05, 116.85],
        maxZoom: 18,
        zoom: 6
    });
    L.supermap.tiledMapLayer(baseUrl, {transparent: true, cacheEnabled: false, noWrap: true}).addTo(map);
    overlayAnalystProcess();

    function overlayAnalystProcess() {
        overlayAnalystService = L.supermap.spatialAnalystService(serviceUrl);
        datasetOverlayAnalystParameters = new SuperMap.DatasetOverlayAnalystParameters({
            sourceDataset: "BaseMap_R@Jingjin",
            operateDataset: "Neighbor_R@Jingjin",
            tolerance: 0,
            operation: SuperMap.OverlayOperationType.UNION
        });
        overlayAnalystService.overlayAnalysis(datasetOverlayAnalystParameters, function (serviceResult) {
            var result = serviceResult.result;
            resultLayer = L.geoJSON(result.recordset.features).addTo(map);
        });
    }
</script>
</body>
</html>